<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>权限管理</title>
    <#include "/common/link.ftl">

    <#--点击重新加载页面：前端用AJAX发送请求，后端返回JSON-->
    <script>
        $(function () {
            $(".btn-reload").click(function () {
                Swal.fire({
                    title: '重新加载',
                    icon: 'warning',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    confirmButtonText: '确定加载'
                }).then((result) => {
                        if (result.value) {
                            $.get("/perm/reload", function (data) {
                                Swal.fire({
                                    // text: data.msg,
                                    icon: 'success',
                                    confirmButtonColor: '#3085d6',
                                    cancelButtonColor: '#d33',
                                    confirmButtonText: '更新成功'
                                }).then((result) => {
                                    window.location.reload();
                                })
                            })
                        } else {
                            Swal.fire({
                                // text: data.msg,
                                icon: 'error',
                                confirmButtonColor: '#3085d6',
                                cancelButtonColor: '#d33',
                                confirmButtonText: '更新失败'
                            }).then((result) => {
                                window.location.reload();
                            })
                        }


                    }
                )

            })
        })
    </script>

</head>
<body class="hold-transition skin-black sidebar-mini">
<div class="wrapper">
    <#include "/common/navbar.ftl">
    <!--菜单回显-->
    <#assign currentMenu="permission"/>
    <#include "/common/menu.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>权限管理</h1>
        </section>
        <section class="content">
            <div class="box">
                <!--高级查询---><#--点击下一页其实也是表单的提交-->
                <form class="form-inline" id="searchForm" action="/perm/list" method="post">
                    <input type="hidden" name="currentPage" id="currentPage" value="1">
                    <a href="javascript:;" class="btn btn-success btn-reload" style="margin: 10px;">
                        <span class="glyphicon glyphicon-repeat"></span> 重新加载
                    </a>
                </form>
                <div class="box-body table-responsive ">
                    <table class="table table-hover table-bordered table-striped">
                        <thead>
                        <tr>
                            <th>编号</th>
                            <th>权限名称</th>
                            <th>权限表达式</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <#list pageInfo.list as permission>
                            <tr>
                                <td>${permission_index+1}</td>
                                <td>${permission.name}</td>
                                <td>${permission.expression}</td>
                                <td>
                                    <a class="btn btn-danger btn-xs btn-delete">
                                        <span class="glyphicon glyphicon-trash"></span> 禁用
                                    </a>
                                </td>
                            </tr>
                        </#list>
                        </tbody>
                    </table>
                    <#include "/common/page.ftl">
                </div>
            </div>
        </section>
    </div>
    <#include "/common/footer.ftl">
</div>
</body>
</html>
